package top.lixunda.books3.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.lixunda.books3.dao.UserBindMapper;
import top.lixunda.books3.entity.UserBind;
import top.lixunda.books3.service.UserBindService;

import java.util.Date;

@Service
public class UserBindServiceImpl implements UserBindService {

    @Autowired
    private UserBindMapper userbindMapper;

    @Override
    public UserBind bindToSystemUser(long systemId, String id, String userType) {
        UserBind userbind = new UserBind();
        userbind.setSystemid(systemId);
        userbind.setId(id);
        userbind.setUsertype(userType);
        userbind.setBindtime(new Date().getTime());
        if(userbindMapper.insert(userbind) == 0){
            return null;
        }
        return userbind;
    }
}
